CFLAGS := -O2 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -fno-strict-aliasing
CFLAGS += -Werror -Wformat -Wformat-security -D_GNU_SOURCE -fPIC -fstack-protector-strong -fno-common
CFLAGS  += `pkg-config --cflags glib-2.0`

LDFLAGS := -fPIE -pie -Wl,-z,relro,-z,now -Wl,-z,noexecstack,-s
LDFLAGS += `pkg-config --libs glib-2.0`

CC := gcc

OBJS := qt_proxy
SRCS := ./src/proxy.c \
        ./src/transfer.c

INC := -I./include

objects := $(SRCS:.c=.o)

%.o: %.c
	$(CC) $(CFLAGS) $(INC) -o $@ -c $<

$(OBJS): $(objects)
	$(CC) $(LDFLAGS) -o $@ $^

CLEANFILES := $(objects) $(OBJS)

.PHONY: all clean

all: $(OBJS)

clean:
	rm -f ${CLEANFILES}
